import { Injectable } from '@nestjs/common';
import { CreateUploadDto } from './dto/create-upload.dto';
import { UpdateUploadDto } from './dto/update-upload.dto';

@Injectable()
export class UploadService {
  // 单文件上传
  handleUpload(file: Express.Multer.File) {
    const fileUrl = `http://localhost:3000/joshua/${file.filename}`;
    return {
      data: { fileUrl },
      status: 200,
      message: '文件上传成功',
    };
  }

  // 处理多文件上传
  handleMultipleUpload(files: Express.Multer.File[]) {
    const fileUrls = files.map(file => `http://localhost:3000/joshua/${file.filename}`);
    console.log('fileUrls', fileUrls)
    return {
      data: { fileUrls },
      status: 200,
      message: '文件上传成功',
    };
  }
}
